﻿using System;
using System.Resources;

namespace Avalon.Core.MVC.Attributes {
    [AttributeUsage(AttributeTargets.Class)]
    public class EntityDescriptionAttribute : Attribute {
        private string _Title;
        private string _Description;

        /// <summary>
        /// The title
        /// </summary>
        public string Title {
            get {
                if (ResourceType != null) {
                    ResourceManager resourceManager = new ResourceManager(ResourceType);
                    return resourceManager.GetString(_Title);
                }
                return _Title;
            }
            set { _Title = value; }
        }

        /// <summary>
        /// The description
        /// </summary>
        public string Description {
            get {
                if (ResourceType != null) {
                    ResourceManager resourceManager = new ResourceManager(ResourceType);
                    return resourceManager.GetString(_Description);
                }
                return _Description;
            }
            set { _Description = value; }
        }


        /// <summary>
        /// The resource type
        /// </summary>
        public Type ResourceType { get; set; }
    }
}
